package com.hzncc.flowable_diboot.project_contracts.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractAudit;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
* 项目类合同评审 DTO定义
*
* @author MyName
* @version 1.0
* @date 2024-09-24
 * Copyright © MyCorp
*/
@Getter
@Setter
@Accessors(chain = true)
public class ProjectContractAuditDTO extends ProjectContractAudit  {
private static final long serialVersionUID = 1561629072102892576L;

        /**
        * 合同版本号 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "contract_version")
        private Long contractVersionBegin;

        /**
        * 合同版本号 截止
        */
        @BindQuery(comparison = Comparison.LE, column = "contract_version")
        private Long contractVersionEnd;
        /**
        * 评审时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime auditTime;
        /**
        * 评审时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "audit_time")
        private LocalDate auditTimeBegin;

        /**
        * 评审时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "audit_time")
        private LocalDate auditTimeEnd;
        /**
        * 计划下达时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime plannedReleaseTime;
        /**
        * 计划下达时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "planned_release_time")
        private LocalDate plannedReleaseTimeBegin;

        /**
        * 计划下达时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "planned_release_time")
        private LocalDate plannedReleaseTimeEnd;
        /**
        * 计划发货时间 
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime plannedDeliveryTime;
        /**
        * 计划发货时间  起始
        */
        @BindQuery(comparison = Comparison.GE, column = "planned_delivery_time")
        private LocalDate plannedDeliveryTimeBegin;

        /**
        * 计划发货时间  截止
        */
        @BindQuery(comparison = Comparison.LT, column = "planned_delivery_time")
        private LocalDate plannedDeliveryTimeEnd;
        /**
        * 开标日期
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime bidOpeningDate;
        /**
        * 开标日期 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "bid_opening_date")
        private LocalDate bidOpeningDateBegin;

        /**
        * 开标日期 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "bid_opening_date")
        private LocalDate bidOpeningDateEnd;
        /**
        * 填写日期
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime writeDate;
        /**
        * 填写日期 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "write_date")
        private LocalDate writeDateBegin;

        /**
        * 填写日期 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "write_date")
        private LocalDate writeDateEnd;
        /**
        * 创建时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime createTime;
        /**
        * 创建时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "create_time")
        private LocalDate createTimeBegin;

        /**
        * 创建时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "create_time")
        private LocalDate createTimeEnd;
        /**
        * 更新时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime updateTime;
        /**
        * 更新时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "update_time")
        private LocalDate updateTimeBegin;

        /**
        * 更新时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "update_time")
        private LocalDate updateTimeEnd;

        public LocalDate getAuditTimeEnd() {
            if (getAuditTime() != null) {
                return getAuditTime().plusDays(1).toLocalDate();
            }
            if (auditTimeEnd != null) {
                return auditTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getPlannedReleaseTimeEnd() {
            if (getPlannedReleaseTime() != null) {
                return getPlannedReleaseTime().plusDays(1).toLocalDate();
            }
            if (plannedReleaseTimeEnd != null) {
                return plannedReleaseTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getPlannedDeliveryTimeEnd() {
            if (getPlannedDeliveryTime() != null) {
                return getPlannedDeliveryTime().plusDays(1).toLocalDate();
            }
            if (plannedDeliveryTimeEnd != null) {
                return plannedDeliveryTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getBidOpeningDateEnd() {
            if (getBidOpeningDate() != null) {
                return getBidOpeningDate().plusDays(1).toLocalDate();
            }
            if (bidOpeningDateEnd != null) {
                return bidOpeningDateEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getWriteDateEnd() {
            if (getWriteDate() != null) {
                return getWriteDate().plusDays(1).toLocalDate();
            }
            if (writeDateEnd != null) {
                return writeDateEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getCreateTimeEnd() {
            if (getCreateTime() != null) {
                return getCreateTime().plusDays(1).toLocalDate();
            }
            if (createTimeEnd != null) {
                return createTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getUpdateTimeEnd() {
            if (getUpdateTime() != null) {
                return getUpdateTime().plusDays(1).toLocalDate();
            }
            if (updateTimeEnd != null) {
                return updateTimeEnd.plusDays(1);
            }
            return null;
        }

}